package com.demo.controller;

import java.util.Map;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import com.demo.service.BookService;

@Controller  
public class BooksController {

	@Autowired
	private BookService bookService;

	private static final Logger logger = LoggerFactory.getLogger(BooksController.class);
	
	@RequestMapping({"/books","/"})
	public String books(Map<String, Object> context) throws Exception {
		context.put("books", bookService.findBooks());
		logger.info("开始进入书籍详细信息页面！");
		return "books";
	}
	
	@RequestMapping("/login")
	public String login(){
		logger.info("进入登录页面！");
		return "login";
	}

}
